/**
 * 
 */
package panel;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingConstants;

import modele.ModeleTablePoste;

import org.jdesktop.swingx.JXPanel;

import classe.*;

/**
 * @author guispeed4262
 *
 */
public class PanelFactHaut extends JXPanel {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JXPanel panDevisHaut;
	private Programme ent;
	private String ref;
	private PageGestFacture panelFacture;
	private JButton boutonPrint,boutonDel;

	
	public PanelFactHaut(Programme ent,String ref,PageGestFacture panelFacture){
		this.ent=ent;
		this.ref=ref;
		this.panelFacture=panelFacture;
		this.setMaximumSize(new Dimension(1000,200));
		this.setLayout(new BorderLayout());
		this.add(getPanDevisHaut(), BorderLayout.CENTER);
	}
	
	public JXPanel getPanDevisHaut(){
		if (panDevisHaut == null){
			panDevisHaut = new JXPanel();		
			panDevisHaut.setLayout(new FlowLayout());
			panDevisHaut.setPreferredSize(new Dimension(300,55));
			panDevisHaut.setBorder(BorderFactory.createLineBorder(Color.black));			
			panDevisHaut.add(getBoutonDel());
			panDevisHaut.add(getBoutonPrint());
		}
		return panDevisHaut;
	}
	public JButton getBoutonPrint(){
		if(boutonPrint == null){
			boutonPrint= new JButton(new ImageIcon("./img/Print.gif"));
	    }
	    return boutonPrint;
	}
	public JButton getBoutonDel(){
		if(boutonDel== null){
			boutonDel= new JButton(new ImageIcon("./img/Erase.gif"));
			boutonDel.addActionListener(new ActionListener(){
        		public void actionPerformed (ActionEvent e ){	
        			ent.suppDevisAcc(ref);
        			ent.suppFact(ref);        			
        			panelFacture.miseAJour();
        		}
			});
			
	    }
	    return boutonDel;
	}


}
